import Vue from 'vue'
import Router from 'vue-router'
const Home = () =>
    import ('../views/Home/Home.vue');
const Mall = () =>
    import ('../views/Mall/Mall.vue');
const Goods = () =>
    import ('../views/Mall/Detail/Goods.vue');
const Release = () =>
    import ('../views/Mall/GoodRelease.vue')
const Square = () =>
    import ('../views/Square/Square.vue');
const Music = () =>
    import ('../views/Music/Music.vue');
const Chat = () =>
    import ('../views/Chat/Chat.vue');
const Conversation = () =>
    import ('../views/Chat/Conversation/Conversation.vue')
const Profile = () =>
    import ('../views/Profile/Profile.vue');
const ProfileEdit = () =>
    import ('../views/Profile/ProfileEdit.vue')
const Song = () =>
    import ('../views/Song/Song.vue');
const SquarePost = () =>
    import ('../views/Square/SquarePost.vue')
const UserReg = () =>
    import ('../views/User/UserReg.vue')
const UserLog = () =>
    import ('../views/User/UserLogin.vue');
const UserIndex = () =>
    import ('../views/User/UserIndex.vue')
const Form = () =>
    import ('../views/Profile/Form.vue')
Vue.use(Router);

export default new Router({
    routes: [{
            path: '/',
            redirect: '/home'
        }, {
            path: '/home',
            component: Home
        }, {
            path: '/mall',
            component: Mall
        },
        {
            path: '/good/:gid',
            component: Goods
        }, {
            path: '/release',
            component: Release
        }, {
            path: '/square',
            component: Square
        }, {
            path: '/square_post',
            component: SquarePost
        }, {
            path: '/music',
            component: Music,
        }, {
            path: '/profile',
            component: Profile
        }, {
            path: '/user_edit',
            component: ProfileEdit
        }, {
            path: '/reg',
            component: UserReg
        }, {
            path: '/login',
            component: UserLog
        }, {
            path: '/uindex/:uid',
            component: UserIndex
        }, {
            path: '/chat',
            component: Chat
        }, {
            path: '/conversation/:uid/:type',
            component: Conversation
        }, {
            path: '/form',
            component: Form
        }
    ],
    mode: 'history'
})
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}